<? include ("../init.php") ?>
<? include ("../header.php") ?>
<? include ("../menu.php") ?>
<? include ("submenu.php") ?>
<?
  $aid = $_GET['aid'];
  $sql = "SELECT * FROM promotion WHERE promo_id= '".$aid."'";
  $promo_info = $db->queryUniqueObject($sql);
  
  if($promo_info->promo_active==1){
    $show=' checked="checked"';
    $hide='';
  }else{
    $show='';
    $hide=' checked="checked"';
  }
?>
<div id = "body">

<h1>+<?_l('edit')?> <?_l('promotion')?></h1>
<div class = "clear"></div>


<form method="post" action="update.php" class = "form" enctype="multipart/form-data">
  <input type="hidden" name="aid" value="<?php echo $aid; ?>" />
  <div class = "field"><label><?_l('title')?></label><input type = "text" name = "title" class = "input size1" value="<?php echo $promo_info->promo_title; ?>" ></div>
  
  <div class = "field"><label><?_l('image')?></label><input type = "file" name = "image" class = "input size1" ></div>
  <?php
    if($promo_info->promo_img!='' && file_exists('../../images/promotions/'.$promo_info->promo_img)){
      echo '<div class = "field"><label>&nbsp;</label><img src="../../images/promotions/'.$promo_info->promo_img.'" /></div>';
      echo '<input type="hidden" name="oldimg" value="'.$promo_info->promo_img.'" />';
    }
  ?>
  
  <div class = "field"><label>
    <?_l('status')?></label>
    <?_l('show')?><input type="radio" name="status" value="1" <?php echo $show; ?> />
    <?_l('hide')?><input type="radio" name="status" value="0" <?php echo $hide; ?> />
  </div>
  
  <div class = "field"><label><?_l('detail')?></label><textarea name = "detail"><?php echo $promo_info->promo_detail; ?></textarea></div>
  
  <hr>
  <div class = "field"><label></label><input type = "submit" value = "<?=__l('update')?>" class = "btn">&nbsp;<a href = "#" class = "btn" onclick="javascript:history.back(1)"><?_l('cancel')?></a></div>
</form>

</div>

<style>
  .form label {
    width:80px;
  }
</style>
</div>
<? include "../footer.php" ?>